//package tech.dort.dortware.impl.modules.exploit;
//
//import com.google.common.eventbus.Subscribe;
//import net.minecraft.client.gui.ScaledResolution;
//import net.minecraft.entity.Entity;
//import net.minecraft.entity.player.EntityPlayer;
//import net.minecraft.entity.player.PlayerCapabilities;
//import net.minecraft.network.play.client.C02PacketUseEntity;
//import net.minecraft.network.play.client.C03PacketPlayer;
//import net.minecraft.network.play.client.C13PacketPlayerAbilities;
//import net.minecraft.network.play.server.S08PacketPlayerPosLook;
//import net.minecraft.util.ChatComponentText;
//import net.minecraft.util.EnumChatFormatting;
//import skidmonke.Client;
//import tech.dort.dortware.api.font.CustomFontRenderer;
//import tech.dort.dortware.api.module.Module;
//import tech.dort.dortware.api.module.ModuleData;
//import tech.dort.dortware.api.property.impl.BooleanValue;
//import tech.dort.dortware.api.property.impl.NumberValue;
//import tech.dort.dortware.impl.events.PacketEvent;
//import tech.dort.dortware.impl.events.RenderHUDEvent;
//import tech.dort.dortware.impl.events.UpdateEvent;
//import tech.dort.dortware.impl.modules.render.Hud;
//import tech.dort.dortware.impl.utils.networking.PacketUtil;
//import tech.dort.dortware.impl.utils.pathfinding.DortPathFinder;
//import tech.dort.dortware.impl.utils.pathfinding.Vec3;
//import tech.dort.dortware.impl.utils.render.ColorUtil;
//import tech.dort.dortware.impl.utils.time.Stopwatch;
//
//import java.util.ArrayList;
//import java.util.Collections;
//
//public class Vanish extends Module {
//
//    Entity entity;
//    final Stopwatch stopwatch = new Stopwatch();
//    final CustomFontRenderer font = Client.INSTANCE.getFontManager().getFont("Small1").getRenderer();
//
//    private final NumberValue teleportDelay = new NumberValue("Teleport Delay", this, 1000, 50, 5000, true);
//    private final BooleanValue removeEntity = new BooleanValue("Remove Entity", this, false);
//    private final BooleanValue fakeMsg = new BooleanValue("Fake Message", this, false);
//    private final BooleanValue render = new BooleanValue("Render", this, true);
//
//    public Vanish(ModuleData moduleData) {
//        super(moduleData);
//        register(teleportDelay, removeEntity, fakeMsg, render);
//    }
//
//    @Subscribe
//    public void onRender(RenderHUDEvent event) {
//        if (!render.getValue())
//            return;
//
//        Hud hud = Client.INSTANCE.getModuleManager().get(Hud.class);
//        ScaledResolution sr = new ScaledResolution(mc);
//        if (hud.isToggled() && entity != null) {
//            font.drawStringWithShadow("Currently disabling using \247f" + entity.getName(), (sr.getScaledWidth() >> 1) - 12 - font.getWidth("Currently disabling " + entity.getName()) / 2, 8, ColorUtil.getModeColor());
//        }
//    }
//
//    @Subscribe
//    public void onUpdate(UpdateEvent event) {
//        ArrayList<tech.dort.dortware.impl.utils.pathfinding.Vec3> path;
//        if (stopwatch.timeElapsed(teleportDelay.getValue().longValue()) && entity != null) {
//            final PlayerCapabilities playerCapabilities = new PlayerCapabilities();
//            playerCapabilities.allowFlying = true;
//            playerCapabilities.isFlying = true;
//            PacketUtil.sendPacketNoEvent(new C13PacketPlayerAbilities(playerCapabilities));
//
//            path = DortPathFinder.computePath(new tech.dort.dortware.impl.utils.pathfinding.Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ), new tech.dort.dortware.impl.utils.pathfinding.Vec3(entity.posX, entity.posY, entity.posZ));
//
//            for (tech.dort.dortware.impl.utils.pathfinding.Vec3 vector : path) {
//                PacketUtil.sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(vector.getX(), vector.getY(), vector.getZ(), true));
//            }
//
//            for (int i = 0; i < 3; i++) {
//                PacketUtil.sendPacketNoEvent(new C02PacketUseEntity(entity, C02PacketUseEntity.Action.INTERACT));
//            }
//
//            Collections.reverse(path);
//
//            for (Vec3 vector : path) {
//                PacketUtil.sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(vector.getX(), vector.getY(), vector.getZ(), true));
//            }
//
//            if (fakeMsg.getValue()) {
//                mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "You are paper-thin! WOOSH!"));
//            }
//
//            stopwatch.resetTime();
//        }
//    }
//
//    @Subscribe
//    public void onPacket(PacketEvent event) {
//        switch (event.getPacketDirection()) {
//            case OUTBOUND:
//                if (event.getPacket() instanceof C02PacketUseEntity && entity == null) {
//                    C02PacketUseEntity packetUseEntity = event.getPacket();
//                    if (entity instanceof EntityPlayer)
//                        return;
//
//                    entity = packetUseEntity.getEntityFromWorld(mc.theWorld);
//
//                    if (removeEntity.getValue()) {
//                        entity.setInvisible(true);
//                    }
//
//                    stopwatch.resetTime();
//                }
//                break;
//
//            case INBOUND:
//                if (event.getPacket() instanceof S08PacketPlayerPosLook && entity != null && mc.thePlayer.ticksExisted > 20) {
//                    S08PacketPlayerPosLook packetPlayerPosLook = event.getPacket();
//                    event.setCancelled(true);
//                    PacketUtil.sendPacketNoEvent(new C03PacketPlayer.C06PacketPlayerPosLook(packetPlayerPosLook.func_148932_c(), packetPlayerPosLook.func_148928_d() + 0.0625D, packetPlayerPosLook.func_148933_e(), mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, true));
//                }
//                break;
//        }
//    }
//
//    @Override
//    public void onDisable() {
//        if (removeEntity.getValue()) {
//            entity.setInvisible(false);
//        }
//
//        entity = null;
//        super.onDisable();
//    }
//}